<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>switch 语句</title>
</head>
<body>
	<h1>switch 语句举例</h1><hr>
	红楼梦
	<ol>
		<li>宝刹判词</li>
		<li>元春判词</li>
		<li>探春判词</li>
		<li>迎春判词</li>
		<li>惜春判词</li>
	</ol>
	<p>输入数字,输出不同判词</p>
	<form id="form1" name="form1">
		<input type="text" id="Num" name="Num" size="20" value="请输入数字">
		<input type="button" value="看一下" onclick="NumSubmit();">
	</form>
	<script type="text/javascript">
		function NumSubmit() {
			InputNum = document.form1.Num.value;
			if(isNaN(InputNum)) {
				//firefox中alert如果为空,不弹出窗口,ie则弹出空白内容
				alert("不是数值");
			} else {
				if(InputNum == "") {
					alert("不能为空");
				} else {
					showPanci(InputNum);
				}
			}
		}
		
		function showPanci(Numb) {
			var Numb;
			switch(Numb) {
				case "1":
					alert("1111111111");
					break;
				case "2":
					alert("22222222222");
					break;
				case "3":
					alert("333333333333");
					break;
				case "4":
					alert("444444444444");
					break;
				case "5":
					alert("555555555555555");
					break;
				default:
					alert("ddddd");
					break;
			}
		}	
	</script>
</body>
</html>